<template>
	<u-gap height="20"></u-gap>
	<view class="u-p-l-20 u-p-r-20">
		<u-radio-group :wrap="true" shape="circle" :size="34" :icon-size="20" style="width: 100%;" v-model="radioSid">
			<view v-for="(item,index) in list" :key="item.sid" style="width: 100%;">
				<view class="box-radius u-flex bgw">
					<view class="u-flex u-p-20" style="width: 80upx;">
						<u-radio :key="index" :name="item.sid"
							active-color="#117B12"></u-radio>
					</view>
					<view class="u-p-r-28 u-flex-1">
						<item :border="false" :detail="item">
							<template v-slot:right>
								<view class="">
									x1
								</view>
							</template>
						</item>
					</view>
				</view>
				<u-gap height="28"></u-gap>
			</view>
		</u-radio-group>
	</view>
	<g-loadmore :status="loadmoreStatus"></g-loadmore>
	<u-gap height="150"></u-gap>
	<view class="fixed-bottom u-p-l-48 u-p-r-48 u-p-t-20 u-p-b-20 bgw">
		<view class="u-flex">
			<view class="u-flex-1 u-p-l-10 u-p-r-10">
				<u-button @click="submit" type="primary" shape="circle" :disabled="!radioSid">确认选择</u-button>
			</view>
		</view>
	</view>

</template>
<script setup>
	import store from '@/store/index.js';
	import mixins from '@/common/js/mixins.js';
	import mixinList from '@/common/js/mixinList.js';
	import {
		ref,
		reactive,
		computed,
		watch,
		getCurrentInstance
	} from 'vue'
	import {
		onReady,
		onLoad,
		onShow,
		onPageScroll
	} from '@dcloudio/uni-app'
	const {
		proxy,
	} = getCurrentInstance()
	const {
		nav,
		navLogin,
		navGLogin
	} = proxy.$util;
	const {
		total,
		current_page,
		page_size,
		last_page,
		apiPath,
		loading,
		list,
		searchParams,
		getList,
		getNextList,
		loadmoreStatus,
		searchClear,
		searchConfirm
	} = mixinList();
	const props = defineProps({
		sid: {
			type: [String, Number],
			default: '',
		}
	})
	
	apiPath.value = 'getProduct'
	searchParams.type = 0
	searchParams.productStatus = 1
	const radioSid = ref('')
	if(props.sid){
		radioSid.value = props.sid
	}
	
	const submit = () =>{
		if(!radioSid.value){
			uni.$u.toast('请选择商品');
			return;
		}
		let good = list.find(v=>v.sid == radioSid.value);
		uni.$emit('choose_good',good);
		uni.navigateBack();
	}

	onReady(() => {

	})
	onLoad(async (d) => {
		await getList(1)
	})
	onShow(() => {

	})
	onPageScroll(e => {

	})
</script>
<style>

</style>
<style lang="scss" scoped>
	.fixed-bottom {
		background-color: #ffffff;
		box-shadow: 0 -4upx 20upx 0 rgba(0, 0, 0, 0.06);
		bottom: 0;
		z-index: 999;
	}
</style>